struct timeval { long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* additional microseconds */ }The nominal resolution of this timestamp is 1 microsecond. However, it is not practical for the kernel to update an internal timestamp with this frequency. The actual timestamp value is updated at intervals that are convenient to the kernel. The intervals are not regular, and they differ with hardware and with the version of IRIX in use. However they are never greater than 10 milliseconds.
This does not mean that successive calls to gettimeofday() return the same value. On the contrary, experimentation reveals that successive calls always return different values. (See the sample program under "Getting the Time of Day Stamp".)
Normally an IRIX system uses one of the time-synchronization daemons, either timed or timeslave, to keep the local clock accurate. These daemons use adjtime() to adjust the time of day when necessary. (See the timed(1), timeslave(1), and adjtime(2) reference pages.) Thus the timestamp returned by gettimeofday() should reflect the true local time, with an inaccuracy of at worst -10 milliseconds.
Either the date command or the time daemon can adjust the current time by a negative increment. As a result, gettimeofday() can in rare circumstances return duplicate values, or a value that is less than the value from the preceding call (see the date(1) reference page).
The gettimeofday() function returns the time as two long integers in a timespec structure. (For details of the call, refer to the gettimeofday(3) reference page.) The fields of a timeval are as follows:
typedef struct timespec { long tv_sec; /* seconds */ long tv_usec; /* and nanoseconds */ } timespec_t;The nominal resolution of this timestamp is 1 nanosecond. However, it is not practical for the kernel to update an internal timestamp with this frequency. The actual timestamp value is updated at intervals that are convenient to the kernel. The intervals are not regular, and they differ with hardware and with the version of IRIX in use. However they are never greater than 10 milliseconds.
Normally an IRIX system uses one of the time-synchronization daemons, either timed or timeslave, to keep the local clock accurate. These daemons use adjtime() to adjust the time of day when necessary. (See the timed(1), timeslave(1), and adjtime(2) reference pages.) Thus the timestamp returned by clock_gettime() should reflect the true local time, with an inaccuracy of at worst -10 milliseconds.
Either the date command or the time daemon can adjust the current time by a negative increment. As a result, clock_gettime() can in rare circumstances return duplicate values, or a value that is less than the value from the preceding call (see the date(1) reference page).